{% extends "layouts/base.html" %}

{% load i18n %}

{% block content %}
<div class="container mt-5">
  <div class="card shadow-lg p-4">
    <h2 class="text-center mb-4">{% trans "Ranking Olimpíada" %}</h2>

    {% if ranking %}
    <div class="table-responsive-md">
      <table class="table table-striped">
        <thead>
          <tr>
            <th>#</th>
            <th>{% trans "Jogador" %}</th>
            <th class="d-none d-md-table-cell">{% trans "Clan" %}</th>
            <th class="d-none d-md-table-cell">{% trans "Aliança" %}</th>
            <th>{% trans "Pontos Olímpicos" %}</th>
            <th>{% trans "Status" %}</th>
          </tr>
        </thead>
        <tbody>
          {% for player in ranking %}
          <tr>
            <td>{{ forloop.counter }}</td>
            <td>{{ player.char_name|default:"-" }}</td>
            <td class="d-none d-md-table-cell">{{ player.clan_name|default:"-" }}</td>
            <td class="d-none d-md-table-cell">{{ player.ally_name|default:"-" }}</td>
            <td>{{ player.olympiad_points }}</td>
            <td>
              {% if player.online %}
                <span class="badge bg-success">{% trans "Online" %}</span>
              {% else %}
                <span class="badge bg-danger">{% trans "Offline" %}</span>
              {% endif %}
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
    {% else %}
    <div class="alert alert-warning text-center">
      {% trans "Nenhum dado encontrado." %}
    </div>
    {% endif %}
  </div>
</div>
{% endblock %}
